﻿using DevExpress.LookAndFeel;
using DevExpress.XtraBars;

namespace RedRiver.Framework.XtraCommon.Templates{
    public class ButtonBarItem : BarButtonItem{
        public ButtonBarItem(BarManager manager, string text, ItemClickEventHandler handler)
            : this(manager, text, -1, handler) {}

        public ButtonBarItem(BarManager manager, string text, int imageIndex, ItemClickEventHandler handler){
            Manager = manager;
            Caption = text;
            ImageIndex = imageIndex;
            ItemClick += handler;
        }
    }

    public class OptionBarItem : BarCheckItem{
        private bool optionItem = false;

        public OptionBarItem(BarManager manager, string text, ItemClickEventHandler handler)
            : this(manager, text, handler, true) {}

        public OptionBarItem(BarManager manager, string text, ItemClickEventHandler handler, bool optionItem){
            this.optionItem = optionItem;
            Manager = manager;
            Caption = text;
            ItemClick += handler;
        }

        public bool IsOption{
            get { return optionItem; }
        }
    }

    public class CheckBarItem : OptionBarItem{
        private ActiveLookAndFeelStyle style;

        public CheckBarItem(BarManager manager, string text, ItemClickEventHandler handler)
            : this(manager, text, handler, ActiveLookAndFeelStyle.Flat) {}

        public CheckBarItem(BarManager manager, string text, ItemClickEventHandler handler, ActiveLookAndFeelStyle style)
            : base(manager, text, handler, false){
            this.style = style;
        }

        public ActiveLookAndFeelStyle Style{
            get { return style; }
        }
    }

    public class CheckBarItemWithStyle : CheckBarItem{
        private LookAndFeelStyle lfStyle;

        public CheckBarItemWithStyle(BarManager manager, string text, ItemClickEventHandler handler,
                                     ActiveLookAndFeelStyle style, LookAndFeelStyle lfStyle)
            : base(manager, text, handler, style){
            this.lfStyle = lfStyle;
        }

        public LookAndFeelStyle LookAndFeelStyle{
            get { return lfStyle; }
        }
    }
}